<?php defined('SYSPATH') OR die('No direct access allowed.');

class Painel_Controller extends Controller {

	public function __construct(){
		parent::__construct(); // This must be included
		$this->create_view();
		$this->session= Session::instance();
		$auth = new Auth;
		if (!$auth->logged_in()){
			$this->session->set("requested_url","/".url::current()); // this will redirect from the login page back to this page/
			url::redirect('auth');
		}
	}


	public function index(){
		$this->create_view('painel');
		$this->view->cabecalho->title = "Painel";
		$this->view->render(TRUE);
	}
	
	public function csv(){
		$arquivocsv = url::base().'arquivos/prematricula/cadastro2009.csv';
		echo $arquivocsv;
		while ($csvAtual = fgetcsv($arquivocsv,1000)) {
			print_r($csvAtual);
		}
	}

} // End Welcome Controller